﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FarseerGames.FarseerPhysics;

namespace FreeGoo.GameEngine.Renderables.Particles.States
{
    public abstract class ParticleState
    {
        public ParticleState(Particle particle)
        {
            Particle = particle;
            ParticleSelectableInState = true;
            UpdateCollissionProperties();
        }

        public Particle Particle { get; private set; }
        public Engine Engine { get { return Particle.Engine; } }
        public bool ParticleSelectableInState { get; protected set; }
        public virtual CollisionCategory StateCollissionCatagory { get {return Engine.UnlinkedParticleCollisionCategory;}}
        //public virtual CollisionCategory StateCollidesWith { get { return Engine.StaticCollisionCategory /*| Engine.UnlinkedParticleCollisionCategory*/; } }

        // Making particles collide with eachother slows down the program considerably, but it would be nice
        // to implement if some form of faster collider could be implemented
        public virtual CollisionCategory StateCollidesWith { get { return Engine.StaticCollisionCategory /*| Engine.UnlinkedParticleCollisionCategory;*/; } }

        public abstract void PerformStatePhysicsAction();
        
        public virtual void EnteringState()
        {
        }
        
        public virtual void ExitingState()
        {
        }

        protected void UpdateCollissionProperties()
        {
            Particle.Geom.CollisionCategories = StateCollissionCatagory;
            Particle.Geom.CollidesWith = StateCollidesWith;
        }
    }
}
